import fingerGuessing.Computer;
import fingerGuessing.User;

public class FingerGuessing {
    public static void main(String[] args) {
        User user = new User();
        Computer computer = new Computer();
        int sum=0;
        for (int i = 0; i < 10; i++) {
            int number = user.fingerguessing();
            int num=computer.fingerguessing();
            sum=compare(number,num);
        }
        if (sum>5){
            System.out.println("恭喜你，分数是："+sum);
        }else if (sum==5){
            System.out.println("真可惜，分数是："+sum);
        }else{
            System.out.println("下次努力，分数是："+sum);
        }
    }

    //比较
    public static int compare(int number,int num) {
        int difference=number-num;
        int sum=0;
        switch (difference){
            case -2:
            case 1:
                System.out.println("你输了");
                sum-=1;
                break;
            case -1:
            case 2:
                System.out.println("你赢了");
                sum+=1;
                break;
            case 0:
                System.out.println("平局");
                break;
        }
        return sum;
    }
}
